<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/views/include/taglib.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<%@ include file="/views/include/nocachehead.jsp"%>
<title>找回密码</title>
<%@ include file="/views/include/resource.jsp"%>
<script type="text/javascript">
	FindPassword = {
		checkEmail : function() {
			var email = document.getElementById("email");
			var errorMessageFont = document.getElementById("errorMessageFont");
			var pattern = /^([a-zA-Z0-9._-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;
			if (email.value == "") {
				errorMessageFont.innerHTML = "对不起！E-mail不能为空。请输入！";
				return false;
			} else if (!pattern.test(email.value)) {
				errorMessageFont.innerHTML = "对不起！您所输入的E-mail格式不正确。请重新输入！";
				return false;
			} else {
				errorMessageFont.innerHTML = "";
				return true;
			}
		},
		findPswdByEmailRequest : function() {
			var checkEmailResult = FindPassword.checkEmail();
			if (checkEmailResult == true) {
			  	var	findType=document.getElementById("findType");
			  	findType.value="0";
			  	var findPswdForm=document.getElementById("findPswdForm");
			  	findPswdForm.submit();
			}
		},
		findPswdByAnswerRequest : function() {
			var checkEmailResult = FindPassword.checkEmail();
			if (checkEmailResult == true) {
			  	var	findType=document.getElementById("findType");
			  	findType.value="1";
			  	var findPswdForm=document.getElementById("findPswdForm");
			  	findPswdForm.submit();
			}
		}
	}
</script>
</head>
<body>
	<form id="findPswdForm" action="${pageContext.request.contextPath}/user/password/find.html" method="post"> 
		<!-- 
		0:代表通过Email来找回密码;
		1:代表通过回答安全答问来找回密码;
		 -->
		<input type="hidden" name="findType" id="findType" value="0">
		<c:set var="errorMessage" value="${requestScope.errorMessage }"></c:set>
		<c:if test="${errorMessage ne null }">
			<font color="red"></font>
			<br>
		</c:if>
		请输入您的 E-mail:<br> 
		<input type="text" name="email" id="email" style="width: 320px; height: 28px; font-size: 24px;" onblur="javascript:FindPassword.checkEmail();"> <br>
		 <font	id="errorMessageFont" color="red"></font><br> 
		 <a href="javascript:FindPassword.findPswdByAnswerRequest();">通过安全答问找回</a> &nbsp;&nbsp; 
		 <a href="javascript:FindPassword.findPswdByEmailRequest();">通过安全E-mail找回</a>
	</form>
</body>
</html>